﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Xml;
using Ccit.Utils;
using Ccit.OA.Utils;
using System.Collections;
using Ccit.OA.UserControls;
using System.Data.OracleClient;

namespace Ccit.OA.NewsCenter
{
    public class SubmitORA : ISubmit
    {
        #region 根据条件XML获得信息

        public List<MsNews> GetNewsByClause(MsClauseAttr msClauseAttr, string sColumnNo,string sType)
        {
            List<MsNews> lstNews = null;
            string sBeginDate = "", sEndDate = "", sNewsTitle = "", sPromulgator = "", sPicFlag = "";
            string sTopFlag = "", sCategory = "", sNewsStatus = "";
            if (msClauseAttr != null)
            {
                sNewsTitle = msClauseAttr.Title;
                sPromulgator = msClauseAttr.Creator;
                sPicFlag = msClauseAttr.PicFlag;
                sTopFlag = msClauseAttr.TopFlag;
                sCategory = msClauseAttr.Category;
                sNewsStatus = msClauseAttr.NewsStatus;
                sBeginDate = msClauseAttr.BeginDate;
                sEndDate = msClauseAttr.EndDate;
            }
            if (sColumnNo != "")
                sCategory = sColumnNo;
            string sSql = "select * from NEWS_A3 where 1=1";
            if (sCategory == "")
                sSql += " and NEWS_A3_20 in ('')";
            else
                sSql += " and NEWS_A3_20 in (" + sCategory + ")";
            if (sNewsTitle != "")
                sSql += " and NEWS_A3_30 like '%" + sNewsTitle + "%'";
            if (sPromulgator != "")
                sSql += " and NEWS_A3_9994 in(" + sPromulgator + ")";
            if (sPicFlag != "")
                sSql += " and NEWS_A3_50='" + sPicFlag + "'";
            if (sTopFlag != "")
                sSql += " and NEWS_A3_40='" + sTopFlag + "'";
            if (sNewsStatus != "")
                sSql += " and NEWS_A3_110 = '" + sNewsStatus + "'";
            if (sBeginDate != "")
                sSql += " and NEWS_A3_9995>='" + sBeginDate + "'";
            if (sEndDate != "")
                sSql += " and NEWS_A3_9995<='" + sEndDate + "'";
            if (sType != "")
                sSql += " and NEWS_A3_120='" + sType + "'";
            sSql += " order by NEWS_A3_40 desc,NEWS_A3_9995 desc";
            using (IDataReader iReader = DataAccessor.ExecuteReader(sSql))
            {
                lstNews = new List<MsNews>();
                while (iReader.Read())
                {
                    MsNews msNews = new MsNews();
                    msNews.NewsId = iReader["NEWS_A3_10"].ToString();
                    msNews.ColumnNo = iReader["NEWS_A3_20"].ToString();
                    msNews.NewsTitle = iReader["NEWS_A3_30"].ToString();
                    msNews.TopFlag = iReader["NEWS_A3_40"].ToString();
                    msNews.PicFlag = iReader["NEWS_A3_50"].ToString();
                    //msNews.PicId = iReader["NEWS_A3_60"].ToString();
                    msNews.CommentFlag = iReader["NEWS_A3_70"].ToString();
                    msNews.ContentFormat = iReader["NEWS_A3_80"].ToString();
                    msNews.ConnectAddress = iReader["NEWS_A3_90"].ToString();
                    msNews.NewsContent = iReader["NEWS_A3_100"].ToString();
                    msNews.NewsStatus = iReader["NEWS_A3_110"].ToString();
                    msNews.NewsType = iReader["NEWS_A3_120"].ToString();
                    msNews.IssueUserId = iReader["NEWS_A3_9994"].ToString();
                    msNews.IssueDate = iReader["NEWS_A3_9995"].ToString();
                    msNews.lstViewInfo = GetViewInfoByNewsId(msNews.NewsId, "", sBeginDate, sEndDate);
                    msNews.ViewCount = msNews.lstViewInfo.Count.ToString();
                    lstNews.Add(msNews);
                }
            }
            return lstNews;
        }

        #endregion

        #region 根据信息ID获得浏览记录


        public List<MsViewInfo> GetViewInfoByNewsId(string sNewsId, string sUserId, string sBeginDate, string sEndDate)
        {
            string sSql = "select * from NEWS_A6 where 1=1";
            if (sNewsId != "")
                sSql += " and NEWS_A6_10='" + sNewsId + "'";
            if (sUserId != "")
                sSql += " and NEWS_A6_20='" + sUserId + "'";
            if (sBeginDate != "")
                sSql += " and NEWS_A6_30>='" + sBeginDate + "'";
            if (sEndDate != "")
                sSql += " and NEWS_A6_40<='" + sEndDate + "'";
            List<MsViewInfo> lstViewInfo = null;
            using (IDataReader iReader = DataAccessor.ExecuteReader(sSql))
            {
                lstViewInfo = new List<MsViewInfo>();
                while (iReader.Read())
                {
                    MsViewInfo msViewInfo = new MsViewInfo();
                    msViewInfo.NewsId = iReader["NEWS_A6_10"].ToString();
                    msViewInfo.UserId = iReader["NEWS_A6_20"].ToString();
                    msViewInfo.BeginDate = iReader["NEWS_A6_30"].ToString();
                    msViewInfo.EndDate = iReader["NEWS_A6_40"].ToString();
                    lstViewInfo.Add(msViewInfo);
                }
            }
            return lstViewInfo;
        }

        #endregion

        #region 更改当前置顶状态



        public bool ChangeTopFlag(string sNewsId, string sCurrTopFlag)
        {
            bool bFlag = false;
            if (sNewsId != "")
            {
                string sChangedTopFlag = "";
                if (sCurrTopFlag == "0")
                    sChangedTopFlag = "1";
                else
                    sChangedTopFlag = "0";
                string sSql = "Update NEWS_A3 set NEWS_A3_40='" + sChangedTopFlag + "' where NEWS_A3_10='" + sNewsId + "'";
                if (DataAccessor.ExecuteNonQuery(sSql) > 0)
                    bFlag = true;
            }
            return bFlag;
        }

        #endregion

        #region 根据选择的信息ID删除信息


        public bool DeleteNewsByIds(string sNewsIds, string sType)
        {
            bool bFlag = false;
            if (sNewsIds != "")
            {
                ArrayList list = new ArrayList();
                string sNewsId = "", sNewsStatus = "", sSql = "";
                string[] sNewsIdArr = sNewsIds.Split(',');
                AttachClass oAttach = new AttachClass();
                for (int i = 0; i < sNewsIdArr.Length; i++)
                {
                    sNewsId = sNewsIdArr[i];
                    sNewsStatus = GetNewsStatusByNewsId(sNewsId);
                    if (sNewsStatus == "0")
                    {
                        sSql = "delete from NEWS_A3 where NEWS_A3_10='" + sNewsId + "'";
                        list.Add(sSql);
                        sSql = "delete from NEWS_A4 where NEWS_A4_10='" + sNewsId + "'";
                        list.Add(sSql);
                        sSql = "delete from NEWS_A5 where NEWS_A5_60='" + sNewsId + "' and NEWS_A5_70='" + sType + "'";
                        list.Add(sSql);
                        sSql = "delete from NEWS_A6 where NEWS_A6_10='" + sNewsId + "'";
                        list.Add(sSql);
                        sSql = "delete from NEWS_A7 where NEWS_A7_20='" + sNewsId + "'";
                        list.Add(sSql);
                        sSql = oAttach.DeleteAttches("0010", sNewsId);
                        if (sSql != "")
                            list.Add(sSql);
                    }
                }
                if (DataAccessor.ExecuteNonQuery(list) > 0)
                    bFlag = true;
            }
            return bFlag;
        }

        #endregion

        #region 提交或发布信息



        public bool SubmitNewsByIds(string sNewsIds)
        {
            bool bFlag = false;
            if (sNewsIds != "")
            {
                ArrayList list = new ArrayList();
                string sNewsId = "", sIssueType = "", sSql = "";
                string[] sNewsIdArr = sNewsIds.Split(',');
                for (int i = 0; i < sNewsIdArr.Length; i++)
                {
                    sNewsId = sNewsIdArr[i];
                    sIssueType = GetIssueTypeByNewsId(sNewsId);
                    if (sIssueType == "0") //直接发布
                        sSql = "update NEWS_A3 set NEWS_A3_110='2' where NEWS_A3_10='" + sNewsId + "'";
                    else if (sIssueType == "1") //审核发布
                        sSql = "update NEWS_A3 set NEWS_A3_110='1' where NEWS_A3_10='" + sNewsId + "'";
                    list.Add(sSql);
                }
                if (DataAccessor.ExecuteNonQuery(list) > 0)
                    bFlag = true;
            }
            return bFlag;
        }

        #endregion

        #region 根据类型及类型ID获得图片信息


        public MsImage GetImageByNewsId(string sId, string sType)
        {
            MsImage msImage = new MsImage();
            string sSql = "select * from NEWS_A5 where NEWS_A5_60='" + sId + "' and NEWS_A5_70='" + sType + "'";
            using (IDataReader iReader = DataAccessor.ExecuteReader(sSql))
            {
                if (iReader.Read())
                {
                    msImage.PicId = iReader["NEWS_A5_10"].ToString();
                    msImage.PicContent = (byte[])iReader["NEWS_A5_20"];
                    msImage.PicSize = iReader["NEWS_A5_30"].ToString();
                    msImage.PicType = iReader["NEWS_A5_40"].ToString();
                    msImage.PicDesc = iReader["NEWS_A5_50"].ToString();
                    msImage.RelatingId = iReader["NEWS_A5_60"].ToString();
                    msImage.RelatingType = iReader["NEWS_A5_70"].ToString();
                }
            }
            return msImage;
        }

        #endregion

        #region 上传图片


        public string UploadImageByNewsId(MsImage msImage, string sNewsId)
        {
            string sExeResult = "";
            if (msImage != null)
            {
                //ArrayList list = new ArrayList();
                string sConString = DataAccessor.ConnectionString;
                OracleConnection oraConnection = new OracleConnection(sConString);
                oraConnection.Open();
                OracleTransaction transaction = oraConnection.BeginTransaction();
                OracleCommand oraCommand = oraConnection.CreateCommand();
                oraCommand.Transaction = transaction;
                int iCount = 0;
                try
                {
                    string sPicId = DataInterface.GetMaxId("NEWS_A5", "NEWS_A5_10").ToString();
                    byte[] bytePicContent = msImage.PicContent;
                    string sPicSize = msImage.PicSize;
                    string sPicType = msImage.PicType;
                    string sPicDesc = msImage.PicDesc;
                    string sRelatingId = msImage.RelatingId;
                    string sRelatingType = msImage.RelatingType;
                    string sSql = "insert into NEWS_A5(NEWS_A5_10,NEWS_A5_20,NEWS_A5_30,NEWS_A5_40,NEWS_A5_50,NEWS_A5_60,NEWS_A5_70)";
                    sSql += "values(@sPicId,@bytePicContent,@sPicSize,@sPicType,@sPicDesc,@sRelatingId,@sRelatingType)";
                    oraCommand.CommandText = sSql;
                    oraCommand.Parameters.Clear();
                    oraCommand.Parameters.Add("@sPicId",OracleType.VarChar);
                    oraCommand.Parameters["@sPicId"].Value = sPicId;
                    oraCommand.Parameters.Add("@bytePicContent", OracleType.Byte);
                    oraCommand.Parameters["@bytePicContent"].Value = bytePicContent;
                    oraCommand.Parameters.Add("@sPicSize", OracleType.VarChar);
                    oraCommand.Parameters["@sPicSize"].Value = sPicSize;
                    oraCommand.Parameters.Add("@sPicType", OracleType.VarChar);
                    oraCommand.Parameters["@sPicType"].Value = sPicType;
                    oraCommand.Parameters.Add("@sPicDesc", OracleType.VarChar);
                    oraCommand.Parameters["@sPicDesc"].Value = sPicDesc;
                    oraCommand.Parameters.Add("@sRelatingId", OracleType.VarChar);
                    oraCommand.Parameters["@sRelatingId"].Value = sRelatingId;
                    oraCommand.Parameters.Add("@sRelatingType", OracleType.VarChar);
                    oraCommand.Parameters["@sRelatingType"].Value = sRelatingType;
                    iCount += oraCommand.ExecuteNonQuery();

                    if (sRelatingType == "0") //信息中心
                    {
                        sSql = "update NEWS_A3 set NEWS_A3_50='1' where NEWS_A3_10='" + sNewsId + "'";
                        //list.Add(sSql);
                        oraCommand.Parameters.Clear();
                        oraCommand.CommandText = sSql;
                        iCount += oraCommand.ExecuteNonQuery();
                    }
                    else
                        iCount++;

                    //if (DataAccessor.ExecuteNonQuery(list) > 0)
                    //    sExeResult = sPicId;
                    if (iCount > 1)
                    {
                        sExeResult = sPicId;
                        transaction.Commit();
                    }
                    else
                        transaction.Rollback();
                }
                catch (Exception)
                {
                    transaction.Rollback();
                }
                finally
                {
                    if (oraConnection.State != ConnectionState.Closed)
                        oraConnection.Close();
                }
            }
            return sExeResult;
        }

        #endregion

        #region 删除图片

        private string DeleteImageByNewId(string sNewsId, string sType)
        {
            string sSql = "delete from NEWS_A5 where NEWS_A5_60='" + sNewsId + "' and NEWS_A5_70='" + sType + "'";
            return sSql;
        }

        public bool DeleteImage(string sPicId, string sId, string sType)
        {
            bool bFlag = false;
            if (sPicId != "0" && sId != "")
            {
                ArrayList list = new ArrayList();
                string sSql = "delete from NEWS_A5 where NEWS_A5_10='" + sPicId + "'";
                list.Add(sSql);
                if (sType == "0")//信息中心
                {
                    sSql = "update NEWS_A3 set NEWS_A3_50='0' where NEWS_A3_10='" + sId + "'";
                    list.Add(sSql);
                }
                if (DataAccessor.ExecuteNonQuery(list) > 0)
                    bFlag = true;
            }
            return bFlag;
        }

        #endregion

        /// <summary>
        /// 根据信息ID获得发布类型
        /// </summary>
        /// <param name="sNewsId"></param>
        /// <returns></returns>
        private string GetIssueTypeByNewsId(string sNewsId)
        {
            string sResult = "";
            string sSql = "select NEWS_A2_40 from NEWS_A2 left join NEWS_A3 on NEWS_A2_10=NEWS_A3_20 where NEWS_A3_10='" + sNewsId + "'";
            object objResult = DataAccessor.ExecuteScalar(sSql);
            if (objResult != null)
                sResult = objResult.ToString();
            return sResult;
        }

        /// <summary>
        /// 根据信息ID获得信息状态
        /// </summary>
        /// <param name="sNewsId"></param>
        /// <returns></returns>
        private string GetNewsStatusByNewsId(string sNewsId)
        {
            string sResult = "";
            string sSql = "select NEWS_A3_110 from NEWS_A3 where NEWS_A3_10='" + sNewsId + "'";
            object objResult = DataAccessor.ExecuteScalar(sSql);
            if (objResult != null)
                sResult = objResult.ToString();
            return sResult;
        }

        #region 保存信息中心信息


        public string SaveNewsInfo(MsNews msNews, MsContent msContent)
        {
            string sExeResult = "", sSql = "", sNewsId = "";
            string sConString = DataAccessor.ConnectionString;
            OracleConnection oraConnection = new OracleConnection(sConString);
            oraConnection.Open();
            OracleTransaction transaction = oraConnection.BeginTransaction();
            OracleCommand oraCommand = oraConnection.CreateCommand();
            oraCommand.Transaction = transaction;
            int iCount = 0;
            try
            {
                if (msNews != null)
                {
                    string[] sPubMsg = Global.SessionExt.GetSysFieldSQL("NEWS_A3");
                    string sColumnNo = "", sNewsTitle = "", sTopFlag = "", sPicFlag = "", sDiscussFlag = "";
                    string sContentType = "", sUrl = "", sNewsContent = "", sNewsStatus = "", sNewsType = "";
                    sNewsId = msNews.NewsId;
                    sColumnNo = msNews.ColumnNo;
                    sNewsTitle = msNews.NewsTitle;
                    sTopFlag = msNews.TopFlag;
                    sPicFlag = msNews.PicFlag;
                    sDiscussFlag = msNews.CommentFlag;
                    sContentType = msNews.ContentFormat;
                    if (sContentType == "0")
                    {
                        sUrl = "";
                        sNewsContent = msNews.NewsContent;
                    }
                    else if (sContentType == "1")
                    {
                        sUrl = "";
                        sNewsContent = "";
                    }
                    else if (sContentType == "2")
                    {
                        sUrl = "";
                        sNewsContent = "";
                    }
                    else if (sContentType == "3")
                    {
                        sUrl = msNews.ConnectAddress;
                        sNewsContent = "";
                    }

                    sNewsStatus = msNews.NewsStatus;
                    sNewsType = msNews.NewsType;
                    if (sNewsId == "")
                    {
                        sNewsId = DataInterface.GetMaxId("NEWS_A3", "NEWS_A3_10").ToString();
                        sSql = "insert into NEWS_A3(NEWS_A3_10,NEWS_A3_20,NEWS_A3_30,NEWS_A3_40,NEWS_A3_50,NEWS_A3_70,NEWS_A3_80,NEWS_A3_90,NEWS_A3_100,NEWS_A3_110,NEWS_A3_120," + sPubMsg[0];
                        sSql += ") values('" + sNewsId + "','" + sColumnNo + "','" + sNewsTitle.Replace("'", "''") + "','" + sTopFlag + "','" + sPicFlag + "','" + sDiscussFlag + "'";
                        sSql += ",'" + sContentType + "','" + sUrl.Replace("'", "''") + "','" + sNewsContent.Replace("'", "''") + "','" + sNewsStatus + "','" + sNewsType + "'," + sPubMsg[1] + ")";
                    }
                    else
                    {
                        sSql = "update NEWS_A3 set NEWS_A3_20='" + sColumnNo + "',NEWS_A3_30='" + sNewsTitle.Replace("'", "''") + "',NEWS_A3_40='" + sTopFlag + "',NEWS_A3_50='" + sPicFlag + "',NEWS_A3_70='" + sDiscussFlag + "',NEWS_A3_80='" + sContentType;
                        sSql += "',NEWS_A3_90='" + sUrl.Replace("'", "''") + "',NEWS_A3_100='" + sNewsContent.Replace("'", "''") + "',NEWS_A3_110='" + sNewsStatus + "',NEWS_A3_120='" + sNewsType + "' where NEWS_A3_10='" + sNewsId + "'";
                    }
                    oraCommand.CommandText = sSql;
                    iCount = oraCommand.ExecuteNonQuery();
                    if (sPicFlag == "0")
                    {
                        sSql = DeleteImageByNewId(sNewsId, "0");
                        oraCommand.CommandText = sSql;
                        iCount = oraCommand.ExecuteNonQuery();
                    }

                }
                if (msContent != null)
                {
                    byte[] sContent = msContent.Content;
                    string sContentSize = msContent.ContentSize;
                    string sContentType = msContent.ContentType;
                    if (sNewsId != "")
                    {

                        sSql = "delete from NEWS_A4 where NEWS_A4_10='" + sNewsId + "'";
                        oraCommand.CommandText = sSql;
                        iCount = oraCommand.ExecuteNonQuery();
                    }
                    sSql = "insert into NEWS_A4(NEWS_A4_10,NEWS_A4_20,NEWS_A4_30,NEWS_A4_40) values('" + sNewsId + "',@Content,'" + sContentSize + "','" + sContentType + "')";
                    oraCommand.Parameters.Clear();
                    oraCommand.Parameters.Add("@Content", OracleType.Byte);
                    oraCommand.Parameters["@Content"].Value = sContent;
                }
                else
                {
                    sSql = "delete from NEWS_A4 where NEWS_A4_10='" + sNewsId + "'";
                }
                oraCommand.CommandText = sSql;
                iCount = oraCommand.ExecuteNonQuery();
                sExeResult = sNewsId;
                transaction.Commit();
            }
            catch (Exception)
            {
                transaction.Rollback();
            }
            finally
            {
                transaction = null;
                if (oraConnection.State != ConnectionState.Closed)
                    oraConnection.Close();
            }
            return sExeResult;
        }

        #endregion

        #region 根据信息ID获得信息明细


        public MsNews GetNewsByNewsId(string sNewsId)
        {
            MsNews msNews = new MsNews();
            if (sNewsId != "")
            {
                string sSql = "select * from NEWS_A3 where NEWS_A3_10='" + sNewsId + "'";
                using (IDataReader iReader = DataAccessor.ExecuteReader(sSql))
                {
                    if (iReader.Read())
                    {
                        msNews.NewsId = iReader["NEWS_A3_10"].ToString();
                        msNews.ColumnNo = iReader["NEWS_A3_20"].ToString();
                        msNews.NewsTitle = iReader["NEWS_A3_30"].ToString();
                        msNews.TopFlag = iReader["NEWS_A3_40"].ToString();
                        msNews.PicFlag = iReader["NEWS_A3_50"].ToString();
                        msNews.CommentFlag = iReader["NEWS_A3_70"].ToString();
                        msNews.ContentFormat = iReader["NEWS_A3_80"].ToString();
                        msNews.ConnectAddress = iReader["NEWS_A3_90"].ToString();
                        msNews.NewsContent = iReader["NEWS_A3_100"].ToString();
                        msNews.NewsStatus = iReader["NEWS_A3_110"].ToString();
                        msNews.NewsType = iReader["NEWS_A3_120"].ToString();
                        msNews.IssueUserId = iReader["NEWS_A3_9994"].ToString();
                        msNews.IssueDate = iReader["NEWS_A3_9995"].ToString();
                        msNews.lstViewInfo = GetViewInfoByNewsId(msNews.NewsId, "", "", "");
                        msNews.ViewCount = msNews.lstViewInfo.Count.ToString();
                    }
                }
            }
            return msNews;
        }

        #endregion

        #region 根据信息ID获得信息正文


        public MsContent GetNewsContentInfo(string sNewsId)
        {
            MsContent msContent = null;
            if (sNewsId != "")
            {
                string sSql = "select * from NEWS_A4 where NEWS_A4_10='" + sNewsId + "'";
                using (IDataReader iReader = DataAccessor.ExecuteReader(sSql))
                {
                    if (iReader.Read())
                    {
                        msContent = new MsContent();
                        msContent.NewsId = iReader["NEWS_A4_10"].ToString();
                        msContent.Content = (byte[])iReader["NEWS_A4_20"];
                        msContent.ContentSize = iReader["NEWS_A4_30"].ToString();
                        msContent.ContentType = iReader["NEWS_A4_40"].ToString();
                    }
                }
            }
            return msContent;
        }

        #endregion

        #region 保存浏览记录


        public bool SaveViewRecord(MsViewInfo msViewInfo)
        {
            bool bFlag = false;
            if (msViewInfo != null)
            {
                string sSql = "";
                string[] sPubMsg = Global.SessionExt.GetSysFieldSQL("NEWS_A6");
                string sNewsId = msViewInfo.NewsId;
                string sUserId = msViewInfo.UserId;
                string sBeginDate = msViewInfo.BeginDate;
                string sEndDate = msViewInfo.EndDate;
                if (JudgeViewInfo(sNewsId, sUserId))
                {
                    sSql = "update NEWS_A6 set NEWS_A6_40='" + sEndDate + "' where NEWS_A6_10='" + sNewsId + "' and NEWS_A6_20='" + sUserId + "'";
                }
                else
                {
                    sSql = "insert into NEWS_A6(NEWS_A6_10,NEWS_A6_20,NEWS_A6_30,NEWS_A6_40," + sPubMsg[0] + ") values('" + sNewsId + "','" + sUserId + "','" + sBeginDate + "','" + sEndDate + "'," + sPubMsg[1] + ")";
                }
                if (DataAccessor.ExecuteNonQuery(sSql) > 0)
                    bFlag = true;
            }
            return bFlag;
        }

        private bool JudgeViewInfo(string sNewsId, string sUserId)
        {
            string sSql = "select NEWS_A6_10 from NEWS_A6 where NEWS_A6_10='" + sNewsId + "' and NEWS_A6_20='" + sUserId + "'";
            object objResult = DataAccessor.ExecuteScalar(sSql);
            if (objResult == null)
                return false;
            else
                return true;
        }

        #endregion

        #region 获得信息浏览记录


        public List<MsViewInfo> GetViewInfoByNewsId(string sNewsId, string sUserName)
        {
            List<MsViewInfo> lstViewInfo = new List<MsViewInfo>();
            if (sNewsId != "")
            {
                string sSql = "SELECT NEWS_A6_10,USERID,USERNAME,DEPTID,DEPTNAME,NEWS_A6_30,NEWS_A6_40 FROM NEWS_A6 INNSER JOIN V_UDP ON NEWS_A6_20=USERID WHERE NEWS_A6_10='" + sNewsId + "' AND USERNAME LIKE '%" + sUserName + "%' ORDER BY NEWS_A6_40 DESC";
                using (IDataReader iReader = DataAccessor.ExecuteReader(sSql))
                {
                    while (iReader.Read())
                    {
                        MsViewInfo msViewInfo = new MsViewInfo();
                        msViewInfo.NewsId = iReader["NEWS_A6_10"].ToString();
                        msViewInfo.UserId = iReader["USERID"].ToString();
                        msViewInfo.UserName = iReader["USERNAME"].ToString();
                        msViewInfo.DeptId = iReader["DEPTID"].ToString();
                        msViewInfo.DeptName = iReader["DEPTNAME"].ToString();
                        msViewInfo.BeginDate = iReader["NEWS_A6_30"].ToString();
                        msViewInfo.EndDate = iReader["NEWS_A6_40"].ToString();
                        lstViewInfo.Add(msViewInfo);
                    }
                }
            }
            return lstViewInfo;
        }

        #endregion

        /// <summary>
        /// 获得该信息的评论数
        /// </summary>
        /// <param name="sNewsId"></param>
        /// <returns></returns>
        private int GetCommentCountByNewsId(string sNewsId)
        {
            int iCommentCount = 0;
            string sSql = "SELECT COUNT(*) FROM NEWS_A7 WHERE NEWS_A7_20='" + sNewsId + "'";
            object objResult = DataAccessor.ExecuteScalar(sSql);
            if (objResult != null)
            {
                iCommentCount = Convert.ToInt32(objResult);
            }
            return iCommentCount;
        }

        #region ISubmit 成员


        public bool PublicNewsByIds(string NewsId)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region ISubmit 成员


        public bool RevocationNewsByIds(string NewsIds)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region ISubmit 成员


        public bool ReturnNewsByIds(string NewsIds)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region ISubmit 成员


        public bool RemoveNewsByIds(string NewsIds)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region ISubmit 成员


        public bool RemoveNewsByIds(string NewsIds, string Type)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region ISubmit 成员


        public List<MsNews> GetNewsManageList(MsClauseAttr msClauseAttr, string Type)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
